Use $transaction() with a callback for interactive transactions where each step depends on the previous result. Use the array form for sequential independent operations that must be atomic but do not reference each other's results. Pass isolationLevel and timeout options for fine-grained control.
Interactive transactions (callback) — use when each step depends on the result of a previous step.
Sequential transactions (array) — use for truly independent operations that must commit or roll back together.
In interactive transactions, always use the tx client — using this.prisma inside the callback bypasses the transaction.
maxWait controls how long to wait for a connection; timeout controls the transaction duration limit.
Nested interactive transactions are supported in Prisma 5+ via savepoints.